<!--
    THIS EXAMPLE WAS DOWNLOADED FROM https://echarts.apache.org/examples/zh/editor.html?c=doc-example/tutorial-styling-step5
-->
<!DOCTYPE html>
<html style="height: 100%">
<head>
    <meta charset="utf-8">
</head>
<body style="height: 100%; margin: 0">
<div id="container" style="height: 100%"></div>

<!--        <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts-nightly@5.1.2-dev.20210512/dist/echarts.min.js"></script>-->
<script type="text/javascript" src="echarts.min.js"></script>
<!-- Uncomment this line if you want to dataTool extension
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts-nightly@5.1.2-dev.20210512/dist/extension/dataTool.min.js"></script>
-->
<!-- Uncomment this line if you want to use gl extension
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts-gl@2/dist/echarts-gl.min.js"></script>
-->
<!-- Uncomment this line if you want to echarts-stat extension
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts-stat@latest/dist/ecStat.min.js"></script>
-->
<!-- Uncomment this line if you want to use map
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts-nightly@5.1.2-dev.20210512/map/js/china.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts-nightly@5.1.2-dev.20210512/map/js/world.js"></script>
-->
<!-- Uncomment these two lines if you want to use bmap extension
<script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=<Your Key Here>"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts-nightly@5.1.2-dev.20210512/dist/extension/bmap.min.js"></script>
-->

<script type="text/javascript">
    var dom = document.getElementById("container");
    var myChart = echarts.init(dom);
    var app = {};

    var option;


    option = {
        backgroundColor: '#ffffff',
        visualMap: {
            show: false,
            min: 80,
            max: 600,
            inRange: {
                colorLightness: [0, 1]
            }
        },
        color: ["#FFF200", "#FFF200", "#FFF200", "#FFF200", "#FFF200", "#FFF200"],
        legend: {
            orient: 'horizontal',
            x: 'center',
            y: 'bottom',
            itemHeight: 8, //修改icon图形大小
            itemWidth: 8, //修改icon图形大小
            textStyle: {
                fontSize: 12,
            },
            data: ['视频广告', '联盟广告', '邮件营销', '直接访问', '搜索引擎']
        },
        tooltip: {
            trigger: 'item',
            formatter: "{b} : {c} ({d}%)"
        },

        series: [
            {
                name: '访问来源',
                type: 'pie',
                radius: '55%',
                sort: 'ascending',
                data: [
                    {
                        value: 600, name: '视频广告', itemStyle: {
                            color: "#FFF200"
                        }, label: {color: "#FFF200"}
                    },
                    {
                        value: 274, name: '联盟广告', itemStyle: {
                            color: "#FF0000"
                        }
                    },
                    {
                        value: 310, name: '邮件营销', itemStyle: {
                            color: "#00A2E8"
                        }
                    },
                    {
                        value: 335, name: '直接访问', itemStyle: {
                            color: "#6BD089"
                        }
                    },
                    {
                        value: 400, name: '搜索引擎', itemStyle: {
                            color: "#C785C8"
                        }
                    }
                ],

                roseType: 'angle',


                // label: {
                //     normal: {
                //         textStyle: {
                //            color: "#FFF200"
                //         }
                //     },
                // },


                // labelLine: {
                //     normal: {
                //         lineStyle: {
                //             color: "#000000"
                //         }
                //     }
                // },


                // itemStyle: {
                //     normal: {
                //         color: '#c23531',
                //         shadowBlur: 200,
                //         shadowColor: 'rgba(0, 0, 0, 0.5)'
                //     }
                // },


                // itemStyle: {
                //     normal: {
                //         label: {
                //             show: true,
                //             formatter: '{b}',
                //             textStyle: {
                //                 fontSize: 14,
                //                 fontWeight: '500'
                //             }
                //         }
                //     },
                // }


            }
        ]
    };

    if (option && typeof option === 'object') {
        myChart.clear();
        myChart.setOption(option);
          window.addEventListener("resize", () => {
          myChart.resize();
        });
    }

</script>
</body>
</html>
    